home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / dbapg.arc / JULIAN.PRG < prev    next >
Encoding:
Text File  |  1984-08-09  |  2.3 KB  |  65 lines

  1. * Program..: JULIAN.PRG
  2. * Author...: Merrill Anderson
  3. * Date.....: January, 1984
  4. * Notice...: Copyright 1983, 1984 by Merrill Anderson.  All rights reserved.
  5. * dBASE....: II, version 2.4x
  6. * Notes....: Converts a Gregorian Calendar date to a Julian Period day.
  7. * Thi≤ algorithφ i≤ onl∙ accuratσ froφ 1/1/000░ t∩ 12/31/399╣ duσ 
  8. * t∩ ß probleφ witΦ negativσ numbers«  Thi≤ commanΣ filσ i≤ ß 
  9. * subroutinσ t∩ perforφ thσ calculatioε only«  I⌠ expect≤ t∩ bσ 
  10. * passeΣ ß datσ whosσ forma⌠ anΣ conten⌠ havσ alread∙ beeε verifieΣ 
  11. * b∙ thσ callinτ file.
  12. * Parameters passed:
  13. *  Name      typ len  picture - description 
  14. * ---------- --- ---  --------------------------------------
  15. *  Input to program:
  16. *  mdate       C    8  mm/dd/yyyy - Gregorian calendar date.
  17. *
  18. * Internal to program (optional output):
  19. *  mm          N    2  Month of input date.
  20. *  dd          N    2  Day of input date.
  21. *  yr          N    4  Four digit year of input date.
  22. *
  23. * Output:
  24. ¬  da∙         ├    │  Da∙ oµ weeδ - threσ character abbr.
  25. *  jd          N    7  Julian period day - total days 
  26. *                          (good from 0 to 3999 AD +\- ?).
  27. *  mon         C    3  Month of year - three character abbr.
  28. *  month       C    9  Month of year - full spelling.
  29. *  weekday     C    9  Day of week - full spelling.
  30. *
  31. * If not done in a previous program...
  32. SET TALK OFF
  33. *
  34. * Initialize local memvars...
  35. STORE VAL($(mdate,1,2)) TO mm
  36. STORE VAL($(mdate,4,2)) TO dd
  37. STORE VAL($(mdate,7,4)) TO yr
  38. STORE 1721060 TO base
  39. *
  40. * Calculate Julian Period Day...
  41. STORE base + yr*365 + INT(yr/4) - INT(yr/100) + INT(yr/400) +;
  42.   VAL($("000031059090120151181212243273304334",mm*3-2,3)) +;
  43.   dd - VAL($('110000000000',mm,1)) *;
  44.   VAL($('10',1+INT(((yr/4)-INT(yr/4))+.75) *;
  45.   INT(((yr/400)-INT(yr/400))+.9975),1)) to jd
  46. *
  47. * Calculate name of weekday...
  48. STORE $( "Monday   Tuesday  Wednesday" +;
  49.   "Thursday Friday   Saturday Sunday   " ,;
  50.   (INT(INT((((jd/7.00)-INT(jd/7))*7)+.5))*9+1),9) TO weekday
  51. STORE $(weekday,1,3) TO day
  52. *
  53. * Calculate name of month...
  54. STORE $( "January  Febuary  March    April    May      " +;
  55.   "June     July     August   SeptemberOctober  November " +;
  56.   "December" ,mm*9-8,9) TO month
  57. STORE $(month,1,3) TO mon
  58. *
  59. * Release local memvars and return to calling program...
  60. RELEASE mm, dd, yy
  61. RETURN
  62. * EOF: Julian.prg
  63.